<template>
	<view>
		<view class="status_bar"></view>
		<view class="container">
			<view class="arrows">
				<cmd-icon type="chevron-left" size="26" color="#654321" class="chevron-left"></cmd-icon>
			</view>
			<view class="titles">
				<text>Welcome!</text>
				<text>欢迎登录聚云卡</text>
			</view>
			<view class="phone">
				<view class="phone-icon">
					<cmd-icon type="iphone-x" size="26" color="#654321"></cmd-icon>
					<text>手机</text>
				</view>
				<view class="phone-title">
					<input type="number" v-model="phones" maxlength="11" placeholder="输入激活手机号" placeholder-style="color:#AAAAAA;font-size:32rpx" />
				</view>
			</view>

			<view class="pwd">
				<view class="pwd-icon">
					<cmd-icon type="iphone-x" size="26" color="#654321"></cmd-icon>
					<text>登录密码</text>
				</view>
				<view class="pwd-title">
					<input type="password" v-model="pwd" maxlength="11" placeholder="输入6位数以上密码" placeholder-style="color:#AAAAAA;font-size:32rpx" />
				</view>
			</view>

			<view class="login" @click="login">
				<text>登录</text>
			</view>
			<view class="login-pwd" @click="pwdLogins">
				<text>快捷登录</text>
			</view>
			<view class="agreements">
				<text>《用户开通协议》</text>
				<text>《隐私政策》</text>
			</view>
		</view>
	</view>
</template>

<script>
	import cmdIcon from "@/components/cmd-icon/cmd-icon.vue";
	export default {
		data() {
			return {
				phones: '',
				pwd: ''
			}
		},
		components: {
			cmdIcon: cmdIcon
		},
		methods: {
			login() {
				console.log(131)
				var info = {
					'mobile': this.phones,
					'password': this.pwd
				}
				uni.request({
					url: 'https://api.juyunka.com/jsk/loginByPassword',
					data: info,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: 'POST',
					success: (res) => {
						console.log(res)
						if (res.data.code == 1000) {
							uni.setStorageSync('token', res.data.data.token);
							clearInterval(this.clear);
							uni.switchTab({
								url: '/pages/index/index'
							})
						}
					}
				});
			},

			pwdLogins() {
				uni.redirectTo({
					url: '/pages/login/login'
				})
			}
		}
	}
</script>

<style>
	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
	}

	.container {
		display: flex;
		flex-direction: column;
	}

	.arrows {
		width: 750rpx;
		height: 88rpx;

	}

	.chevron-left {
		margin-top: 35rpx;
		margin-left: 15rpx;
	}

	.titles {
		display: flex;
		flex-direction: column;
	}

	.titles text:nth-child(1) {
		font-size: 86rpx;
		color: #1C1C1C;
		font-weight: bold;
		margin-left: 75rpx;
	}

	.titles text:nth-child(2) {
		font-size: 32rpx;
		margin-left: 76rpx;
	}

	input {
		font-size: 32rpx;
	}

	.phone {
		display: flex;
		flex-direction: column;
		margin-top: 118rpx;
		margin-left: 82rpx;
	}

	.phone-icon text {
		font-size: 28rpx;
		margin-left: 10rpx;
	}

	.phone-title {
		width: 540rpx;
		height: 110rpx;
		margin-left: 62rpx;
		border-bottom: 2rpx #F4F4F4 solid;
	}

	.phone-title input {
		margin-top: 30rpx;
	}

	.pwd {
		display: flex;
		flex-direction: column;
		margin-top: 40rpx;
		margin-left: 82rpx;
	}

	.pwd-icon text {
		font-size: 28rpx;
		margin-left: 10rpx;
	}

	.pwd-title {
		width: 540rpx;
		height: 110rpx;
		margin-left: 62rpx;
		border-bottom: 2rpx #F4F4F4 solid;
	}

	.pwd-title input {
		margin-top: 30rpx;
	}

	.login {
		width: 600rpx;
		height: 85rpx;
		border-radius: 12rpx;
		margin: 90rpx 75rpx 0 75rpx;
		background-image: linear-gradient(to right, #FF3C3D, #FF7F62);
		font-size: 36rpx;
		color: #fff;
		line-height: 85rpx;
		text-align: center;
	}

	.login-pwd {
		margin-top: 60rpx;
		font-size: 28rpx;
		color: #AAAAAA;
		text-align: center;
	}

	.agreements {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		font-size: 24rpx;
		color: #FC5E5A;
		margin-top: 105rpx;
	}
</style>
